var path = require('path');
var express = require('express');
const http = require('http');
const fs = require('fs');
var bodyParser = require('body-parser');
const router  =  require('./router')
var app = express();
app.use(bodyParser.json({ limit: '1mb' }));  //body-parser 解析json格式数据
app.use(bodyParser.urlencoded({            //此项必须在 bodyParser.json 下面,为参数编码
    extended: false
}));

//设置ajax前端请求数据跨域处理
app.set("jsonp callback name", "callback");
app.set('view cache', true);



app.use('/',require('./controller/controller'))

if (!module.parent) {
    var a = http.createServer(app)
    a.listen(8888, function () {
       console.log('run 8888')
    });
};